Hello everyone,
I am new to the DXL scripting and i need one help. I am having one project module in doors and so many views in it, I need to have a DXL script to compare couple of columns in the Doors view i.e. i have to compare 2 attributes and generate a report. Say in the first attribute or column in doors where ever there is a text called "step" against a object, the corresponding second column should be with Pass/Fail. if there is nothing mentioned against the second column then the script should list down all the objects which doesnt have anything in the second column Can some one help me out on this.
lokeshchaitanya - Thu Feb 20 14:26:13 EST 2014 |
Re: DXL script to compare 2 columns and print the report Request anyone on this forum to please help me with the script to compare the 2 different attributes and print the report. Thanks in advance |
Re: DXL script to compare 2 columns and print the report How about if we just "show" the offending objects instead of "reporting" them. If you really need a report you can "export" the filtered module. let me scribble, you do the debugging;
If the 1st attribute may "contain" the phrase "step", then you can 1st turn it ino a Regular expression, then search s1 for that. -Louie |
Re: DXL script to compare 2 columns and print the report llandale - Thu Feb 20 16:43:38 EST 2014 How about if we just "show" the offending objects instead of "reporting" them. If you really need a report you can "export" the filtered module. let me scribble, you do the debugging;
If the 1st attribute may "contain" the phrase "step", then you can 1st turn it ino a Regular expression, then search s1 for that. -Louie louie---Thanks for the help. based on your above post i came up with below piece of code and its working super. but at the end i want the output to be populated in a .csv or .excel file. Can you help me in updating the below code snippet to port the output result into a .csv or .xls file.
Module m = current
Object o = null
string oot = ""
int oid
int Count = 0
for o in m do {
oot = o."Test Classification"
if oot == "Step" then
{
oot = o."L3R2 Pass or Fail"
if (oot == "Pass" or oot == "Fail") then
{
Count ++
//print oot
//Do nothing
}
else
{
oid = o."Absolute Number"
print oid "\t" "Pass/Fail missing" "\n"
}
}
}
|
Re: DXL script to compare 2 columns and print the report lokeshchaitanya - Fri Feb 21 16:57:56 EST 2014 louie---Thanks for the help. based on your above post i came up with below piece of code and its working super. but at the end i want the output to be populated in a .csv or .excel file. Can you help me in updating the below code snippet to port the output result into a .csv or .xls file.
Module m = current
Object o = null
string oot = ""
int oid
int Count = 0
for o in m do {
oot = o."Test Classification"
if oot == "Step" then
{
oot = o."L3R2 Pass or Fail"
if (oot == "Pass" or oot == "Fail") then
{
Count ++
//print oot
//Do nothing
}
else
{
oid = o."Absolute Number"
print oid "\t" "Pass/Fail missing" "\n"
}
}
}
To output something to a csv file is pretty easy. In the declarations at the top, declare the file by the following: const string sOutFileName = "c:\\temp\\MyFile.csv" //or where to put it and it's name, note the double backslashes. Sream out = write sOutFileName Then in the loop, when you want to send the data to the file you do something like, out << oid "," "Pass/Fail missing" "\n" Then at the end you close the file by close out
Hope this helps, Greg |
Re: DXL script to compare 2 columns and print the report GregM_dxler - Mon Feb 24 08:49:52 EST 2014 To output something to a csv file is pretty easy. In the declarations at the top, declare the file by the following: const string sOutFileName = "c:\\temp\\MyFile.csv" //or where to put it and it's name, note the double backslashes. Sream out = write sOutFileName Then in the loop, when you want to send the data to the file you do something like, out << oid "," "Pass/Fail missing" "\n" Then at the end you close the file by close out
Hope this helps, Greg Thanks Greg. I updated as per your say and it is working now.
//DXL Script to print the Pass/fail status.
Module m = current
Object o = null
string oot = ""
const string sOutFileName = "c:\\temp\\MyFile.csv"
Stream out = write sOutFileName
int oid
int Count = 0
for o in m do {
oot = o."Test Classification"
if oot == "Step" then
{
oot = o."L3R2 Pass or Fail"
if (oot == "Pass" or oot == "Fail") then
{
Count ++
//print oot
//Do nothing
}
else
{
oid = o."Absolute Number"
print oid "\t" "Pass/Fail status is not updated for this object ID" "\n"
out << oid "," "Pass/Fail missing" "\n"
}
}
}
In the above code snippet, can you suggest along the above status what i am printing also i need to print the Level 1 Heading along with the object ID and the statement "Pass/Fail status is not updated for this object ID"\n". Since i am beginner in this dxl scripting i am asking some of the silly doubts, could you pelase help me in this regard. |